import Notification from './main.js'

let NotificationComponent;
const createNotification = () => {
  NotificationComponent = NotificationComponent || Notification.create();
  return NotificationComponent;
}

let id = 1;

const notice = options => {
  const instance = createNotification();
  instance.notice({
    ...options,
    id: id++,
    show: true
  });
}

export default Vue => {
  Vue.component(Notification.name, Notification)
  Vue.prototype.$notice = notice;
}
